﻿<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<!DOCTYPE html>
<html lang="zh-CN">
  
  <head>
    
    <%@ include file="/WEB-INF/include/meta.jsp"%>
    <%@ include file="/WEB-INF/include/css.jsp"%>
    <link href="${ctx.resource}/css/goals.css" rel="stylesheet">
    <title>人马君</title>
  </head>
  <!-- end header -->
  <body>
    <div class="page-group">
      <div class="page page-current">
        
        <header class="bar bar-nav fs-header-small">
          <a href="${ctx.host}/course-schedules" class="icon icon-left pull-left"></a>
          <h1 class="title" style="z-index: -1;">课程详情</h1>
          <c:if test="${courseSchedules[0].courseRound.courseType.individual && !courseSchedules[0].course.experience && not empty courseSchedules[0].courseRound.fitnessGroup}">
            <a href="${ctx.host}/students/${courseSchedules[0].courseRound.student .id}/rounds/${courseSchedules[0].courseRound.id}?scheduleId=${courseSchedules[0].id}" class="pull-right" style="line-height: 2.2rem;">课件</a>
          </c:if>
        </header>
        
        <div class="bar bar-footer" style="padding: 0;">
          <button class="button button-fill edit" style="top: 0;background: #fedc32; font-size: 1rem; font-weight: bold; color: #333; min-height: 2.2rem; width: 100%;">确定</button>
        </div>
        
        <div class="content">
          <div class="course-info">
            <p>${courseSchedules[0].course.name}</p>
            <p>${courseSchedules[0].occurDate}&nbsp;&nbsp;${courseSchedules[0].occurHour}</p>
            <p>${courseSchedules[0].site.name}</p>
          </div>
          
          <c:forEach var="courseSchedule" items="${courseSchedules}">
            <div class="coach-info" style="margin-top: .3rem;">
              <img class="left" src="${courseSchedule.student.avatar}" alt="student-logo">
              <div class="right">
                <p>${courseSchedule.student.name}</p>
                <p>${courseSchedule.student.mobile}</p>
              </div>
            </div>
          </c:forEach>
          
          <c:if test="${courseSchedules[0].courseRound.courseType.individual && !courseSchedules[0].course.experience}">
            <c:if test="${not empty courseSchedules[0].courseRound.fitnessGroup}">
              <div style="background: white;padding: .25rem .75rem;margin: .75rem 0;">上课内容：
                <span class="pull-right">
                  <c:forEach var="content" items="${plannedSchedule.contentList}" varStatus="status">
                    ${status.index eq 0 ? '' : '+'}${content.description}
                  </c:forEach>
                </span>
              </div>
            </c:if>
            
            <form name="delete_form" action="${ctx.host}/rounds/${courseSchedules[0].courseRound.id}/course-coursewares/${courseSchedules[0].id}/coursewares" method="POST">
              <input type="hidden" name="_method" value="PATCH">
              <div class="content-block-title" style="margin-top: .75rem;">课程
                <c:if test="${not empty coursewares}">
                  <a href="javascript:void(0);" class="pull-right to-delete-button"><span style="font-size: .7rem;color: #0894ec;">删除</span></a>
                </c:if>
              </div>
              <div class="content-block course-target-course target-course" style="padding: 0; margin: 0">
                <div class="basic-item flex-box basic-header">
                  <div class="item" style="width: 30%;flex: none;">动作</div>
                  <div class="item" style="width: 10%;flex: none;">组数</div>
                  <div class="item" style="width: 20%;flex: none;">每组次数</div>
                  <div class="item" style="width: 20%;flex: none;">最大重量</div>
                  <div class="item" style="width: 10%;flex: none;">计时</div>
                  <div class="item" style="width: 10%;flex: none;"></div>
                </div>
                <c:forEach var="courseware" items="${coursewares}" varStatus="varStatus">
                  <div class="basic-item flex-box edit-content-block movement-edit">
                    <label class="delete-movement">
                      <input type="checkbox" name="coursewareId" value="${courseware.id}"/>
                    </label>
                    <input type="hidden" name="coursewares[${varStatus.index}].id" value="${courseware.id}"/>
                    <div class="item flex-shrink" style="width: 30%;flex: none;">${courseware.movement.name}</div>
                    <div class="item" style="width: 10%;flex: none;">
                      <span class="big-size">
                        <input type="text" name="coursewares[${varStatus.index}].groupAmount" value="${courseware.groupAmount eq 0 ? '' : courseware.groupAmount}" placeholder="请输入">
                      </span>
                    </div>
                    <div class="item" style="width: 20%;flex: none;">
                      <span class="big-size">
                        <input type="text" name="coursewares[${varStatus.index}].movementNumber" value="${courseware.movementNumber eq 0 ? '' : courseware.movementNumber}" placeholder="请输入">
                      </span>
                    </div>
                    <div class="item" style="width: 20%;flex: none;">
                      <span class="big-size">
                        <input type="text" name="coursewares[${varStatus.index}].maxWeight" value="${courseware.maxWeight}" placeholder="请输入">
                      </span>
                    </div>
                    <div class="item" style="width: 10%;flex: none;">
                      <span class="big-size">
                        <input type="text" name="coursewares[${varStatus.index}].time" value="${courseware.time}" placeholder="请输入">
                      </span>
                    </div>
                    <a class="item" style="width: 10%;flex: none;color: #929292" href="${ctx.host}/rounds/${courseSchedules[0].courseRound.id}/course-coursewares/${courseSchedules[0].id}/coursewares/${courseware.id}"><span class="icon icon-right"></span></a>
                  </div>
                </c:forEach>
              </div>
            </form>
            
            <div class="row delete-box">
              <div class="col-50" style="margin-left: .25rem;">
                <label>
                  <input type="checkbox" name="" class="all-select"> 全选
                </label>
              </div>
              <div class="col-50">
                <a href="javascript:void(0);" class="button button-fill delete-button">删除动作</a>
              </div>
            </div>
            
            <div class="row add-action-box" style="padding:0 .5rem;">
              <div class="col-50">
                <a href="${ctx.host}/rounds/${courseSchedules[0].courseRound.id}/course-coursewares/${courseSchedules[0].id}/coursewares/add" class="button button-fill add-group">添加动作</a>
              </div>
              <div class="col-50">
                <a href="#group-btn" class="button button-fill add-group" data-toggle="push">添加动作组</a>
              </div>
            </div>
          </c:if>
        </div>
      </div>
    </div>
    
    <%@ include file="/WEB-INF/include/script.jsp"%>
    <d:resource root="${ctx.resource}/build" type="script" src="js/page/course/course-schedule-view.js" />
    <script type="text/javascript">
      require(['page/course/course-schedule-view'], function(page) {
        page.init({
            'roundId': '${courseSchedules[0].courseRound.id}',
            'courseScheduleId': '${courseSchedules[0].id}',
            'groups': JSON.parse('${persist.fitnessGroups}')
        })
      })
    </script>
  </body>
</html>